<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>鲜知</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/login.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .keep-on-record {
            position: absolute;
            bottom: 30px;
            left: 50%;
            width: 300px;
            margin-left: -150px;
            color: #333333;
        }
        .keep-on-record .num {
            text-align: center;
        }
        .keep-on-record .copyright {
            text-align: center;
            margin-top: 10px;
        }
    </style>
</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">鲜知后台管理系统-登录</div>
    <div id="darkbannerwrap"></div>
    <form method="post" class="layui-form" id="login-form">
        {{.xsrfdata}}
        <input id="account" name="account" placeholder="用户名" type="text" lay-verify="" class="layui-input">
        <hr class="hr15">
        <input id="password" name="password" lay-verify="" placeholder="密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
    </form>
</div>

<div class="keep-on-record">
    <div class="num"><a href="http://beian.miit.gov.cn">豫ICP备19045779号</a></div>
    <div class="copyright">河南省闪光文化传媒有限公司 版权所有</div>
</div>

<script>

    var canSubmit = true;

    $(function () {
        layui.use(['form', 'layer'], function () {

            $ = layui.jquery;
            var layer = layui.layer;
            var form = layui.form;

            form.on('submit(login)', function (data) {

                if ($("#account").val().length <= 0) {
                    layer.msg("请输入用户名", {icon: 2});
                    return false;
                }
                if ($("#password").val().length <= 0) {
                    layer.msg("请输入密码", {icon: 2});
                    return false;
                }

                if (!canSubmit) return false;
                var loadIndex = layer.load();
                canSubmit = false;

                $.ajax({
                    url: "{{urlfor "admin.UserAdminController.DoLogin"}}",
                    type: "POST",
                    data: $("#login-form").serialize(),
                    dataType: "json",
                    success: function (res) {

                        layer.close(loadIndex);
                        canSubmit = true;

                        if (res.status != 1) {
                            layer.msg(res.msg, {icon: 2});
                            return false;
                        }

                        layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                            location.href = "{{urlfor "admin.IndexController.Index"}}";
                        });

                    }
                });

                return false;

            });
        });
    })
</script>

</body>
</html>